package base.Day01;
import java.io.IOException;
import java.io.InputStream;
import java.net.*;
public class HelloWorld
{
    public static void main(String[] args) throws IOException
    {
        ServerSocket serverSocket = new ServerSocket(9999);

        Socket socket = serverSocket.accept();

        System.out.println(socket.getClass());

        InputStream inputStream = socket.getInputStream();
        byte[] buf = new byte[1024];

        int readLen = 0;

        while ((readLen = inputStream.read(buf)) != -1)
        {
            System.out.println(new String(buf, 0, readLen));
        }
        inputStream.close();
        socket.close();
        serverSocket.close();
    }
}
